package com.example.demo.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.entity.Menu;
import com.example.demo.entity.Role;
import com.example.demo.entity.dto.PageDto;
import com.example.demo.entity.vo.PageVo;
import com.example.demo.service.MenuService;
import com.example.demo.mapper.MenuMapper;
import com.example.demo.util.QueryWraperUtil;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author admin
* @description 针对表【menu(菜单表)】的数据库操作Service实现
* @createDate 2024-01-08 10:09:46
*/
@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService{

    @Override
    public List<Menu> getList(Menu menu) {
        return baseMapper.selectList(QueryWraperUtil.getQueryWrap(menu));
    }

    @Override
    public PageVo<Menu> getPage(PageDto<Menu> pageDto) {
        IPage<Menu> iPage=baseMapper.selectPage(new Page<>(pageDto.getCurrent(),pageDto.getSize()),QueryWraperUtil.getQueryWrap(pageDto.getCdt()));
        return new PageVo<>(iPage.getRecords(),iPage.getCurrent(),iPage.getSize(),iPage.getTotal());
    }
}




